﻿using DbAccess;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DbHelper.Demo.DAL
{
    public abstract class Common : SimpleDataBase
    {
        public Common(string tableName)
            :base(DataBaseFactory.GetDataBase())
        {
            TableName = tableName;
        }
        /// <summary>
        /// 数据库表名
        /// </summary>
        public string TableName { get; private set; }

        /// <summary>
        /// 查询单条long型数据
        /// </summary>
        /// <param name="row">数据游标</param>
        /// <returns></returns>
        public static long DataReaderForLong(DbDataReader row)
        {
            return row.GetInt64Ex(0);
        }

        /// <summary>
        /// 查询单条int型数据
        /// </summary>
        /// <param name="row">数据游标</param>
        /// <returns></returns>
        public static int DataReaderForInt(DbDataReader row)
        {
            return row.GetInt32Ex(0);
        }
    }
}
